<!DOCTYPE html>
<html lang="cn" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>仓库情况界面</title>

    <!--引入资源文件-->
    <link rel="stylesheet" th:href="@{/static/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/static/css/bootstrap-theme.min.css}">
    <link rel="stylesheet" th:href="@{/static/css/warehouse.css}">

    <script th:src="@{/static/js/jquery.min.js}"></script>
    <script th:src="@{/static/js/bootstrap.min.js}"></script>
    <style>
        html, body {
            width: 100%;
            height: 100%;
        }
    </style>
    <script>
        $(function () {
            $.ajax({
                type: "get",
                async: false,
                url: "WarehouseCondition",
                dataType: "json",
                success: function (data) {

                    for (var i = 0; i < data.length; i++) {
                        if (data[i].cargo_name !== "0") {
                            let place = $("#place" + (i + 1));
                            place.toggleClass('btn-default');
                            place.addClass('btn-primary');

                        }
                    }

                },
                error: function () {

                }
            });
        })
    </script>
</head>
<body style="background-color: #eef0f5">


<div class="col-lg-8 col-md-12 col-sm-12 col-xs-12 userside">
    <div id="warehouseCondition" class="warehousePanle">
        <p>仓库情况概览</p>
        <div>
            <button id="place1" type="button" class="btn btn-default place condition">货位1</button>
            <button id="place2" type="button" class="btn btn-default place condition">货位2</button>
            <button id="place3" type="button" class="btn btn-default place">货位3</button>
        </div>

        <br>
        <div>
            <button id="place4" type="button" class="btn btn-default place condition">货位4</button>
            <button id="place5" type="button" class="btn btn-default place condition">货位5</button>
            <button id="place6" type="button" class="btn btn-default place">货位6</button>
        </div>

    </div>


    <div class="warehousePanle ">
        <p>仓库中货物列表</p>
        <table class="table table-striped" >
            <thead>
            <tr>
                <th>货位</th>
                <th>货物名称</th>
                <th>数量</th>
            </tr>
            </thead>
            <tbody id="cargoInWarehouse">
                <tr th:each="warehouse : ${warehouses}" th:if="${warehouse.cargo_name != '0'}  ">
                    <td th:text="${warehouse.place_id}"></td>
                    <td th:text="${warehouse.cargo_name}"></td>
                    <td th:text="${warehouse.cargo_amount}"></td>
                </tr>
            </tbody>

        </table>
    </div>
</div>

<div class="col-lg-4 col-md-12 col-sm-12 col-xs-12 usercontent">
    <div class="rightlist">
        <p>
            <span>出入库情况</span>
            <span style="float: right">查看更多</span>
        </p>
        <table class="table table-striped righttable">
            <caption>入库</caption>
            <thead>
            <tr>
                <th>货物名称</th>
                <th>货物数量</th>
                <th>拥有人</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="entryOrder : ${entryOrders}">
                <td th:text="${entryOrder.cargo_name}"></td>
                <td th:text="${entryOrder.cargo_amount}"></td>
                <td th:text="${entryOrder.holder}"></td>
            </tr>

            </tbody>
        </table>
        <br>
        <table class="table table-striped righttable">
            <caption>出库</caption>
            <thead>
            <tr>
                <th>货物名称</th>
                <th>货物数量</th>
                <th>拥有人</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="outOrder : ${outOrders}">
                <td th:text=" ${outOrder.cargo_name}"></td>
                <td th:text=" ${outOrder.cargo_amount}"></td>
                <td th:text=" ${outOrder.holder}"></td>
            </tr>

            </tbody>
        </table>
    </div>
</div>


</body>
</html>